﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>

    <title>淘菜菜物流履约培训——签到</title>
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400"/>
    <!-- Google web font "Open Sans" -->
    <link rel="stylesheet" href="assets/train/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="assets/train/css/bootstrap.min.css"/>

    <link rel="stylesheet" href="assets/train/css/demo.css"/>
    <link rel="stylesheet" href="assets/train/css/templatemo-style.css"/>

    <script type="text/javascript" src="assets/train/js/modernizr.custom.86080.js"></script>

</head>

<body>

<div id="particles-js"></div>

<ul class="cb-slideshow">
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
</ul>

<div class="container-fluid">
    <div class="row cb-slideshow-text-container ">
        <div class="tm-content col-xl-6 col-sm-8 col-xs-8 ml-auto section">
            <header class="mb-5"><h1>签到</h1></header>

            <form id="train_sign" class="subscribe-form">
                <div class="row form-section">

                    <div class="col-md-7 col-sm-7 col-xs-7">
                        <input name="userName" type="text" class="form-control" id="userName" placeholder="输入你的花名..." />
                    </div>
                    <div class="col-md-5 col-sm-5 col-xs-5">
                        <button type="button" onclick="trainSign()" class="tm-btn-subscribe">签到</button>
                    </div>

                </div>
            </form>

        </div>
    </div>
</div>
<style>
</style>
</body>

<script type="text/javascript" src="assets/train/js/particles.js"></script>
<script type="text/javascript" src="assets/train/js/app.js"></script>

<script type="text/javascript" src="assets/js/jquery-1.12.4.min.js"></script>

<script>

    function trainSign() {
        $.ajax({
            //几个参数需要注意一下
            type: "POST",//方法类型
            dataType: "json",//预期服务器返回的数据类型
            url: "/api/train/sign.do" ,//url
            data: $('#train_sign').serialize(),
            success: function (message) {
                var result = message;
                alert(result.resultMessage);
                if (result.result) {
                    // 刷新页面
                    window.location.reload();
                }

            },
            error : function() {
                alert("签到异常！");
            }
        });
        // 必须返回false，否则表单会自己再做一次提交操作，并且页面跳转
        return false;
    }
</script>
</html>